<?php 
define('INCLUDED', 1);
include_once('autoloader.php');
//header('Refresh: 1');
$fp = FirePHP::getInstance(true);

    $wyniki =array();
    if(isset($_POST['wyborID']))
    {
        if($_POST['wyborID']=='Wszystko')
        {
         $wyniki = user::pobierzWszystko();
         $fp->error($wyniki);
        }
        else
        {
        $wyniki[] = user::pobierzWszystkoPo($_POST['wyborID']);
        }
    }
    
   
?>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <link href="css/bootstrap.css" rel="stylesheet">
        <link href ="css/bootstrap-responsive.css" rel="stylesheet">
        <title></title>
    </head>
    <body>
        <div class="container-fluid">
            <div class="row-fluid">
              <div class="span2 well btn-group">
               <form class="form-inline" action="add.php" method="post">  
                  <button class="btn">Dodaj</button>
               </form> 
                  <form class="form-inline" action="add.php" method="post">  
                  <button class="btn">Edytuj</button>
               </form>  
               <form action="" method="post"> 
                    <select name="wyborID" class="span12">
                        <?php 
                                echo' <option value="Wszystko">
                                       Wszystko
                                      </option>';
                                
                            $idki = user::pobierzWszystkieID();
                            foreach($idki as $opcja)
                            {
                                echo' <option value="' . $opcja . '">';
                                echo  $opcja;
                                echo' </option>';
                            }
                         ?>
                      </select> 
                        <br>
                      <input type="submit" />
                 </form>  
              </div>
                  
            <table class="table span9 well">
                <td class="span3">ID</td>               
                <td class="span3">Imie</td>
                <td class="span3">Nazwisko</td>
                <td class="span3">Pesel</td>               
                <td class="span3">Adres</td>
                <td class="span3">Kod</td>
                <td class="span3">Telefon</td>               
                <td class="span3">Email</td>
                <td class="span3">Data</td>
                <td class="span3">Rola</td>
             <?php
             
             foreach($wyniki as $val)
             {                                  
              echo'<tr>';   
                echo'<td class="span3">'.$val->pobierzId().'</td>';               
                echo'<td class="span3">'.$val->pobierzImie().'</td>';
                echo'<td class="span3">'.$val->pobierzNazwisko().'</td>';
                echo'<td class="span3">'.$val->pobierzPesel().'</td>';
                echo'<td class="span3">'.$val->pobierzAdres().'</td>';
                echo'<td class="span3">'.$val->pobierzKod().'</td>';
                echo'<td class="span3">'.$val->pobierzTelefon().'</td>';
                echo'<td class="span3">'.$val->pobierzEmail().'</td>';
                echo'<td class="span3">'.$val->pobierzDataDodania().'</td>';
                echo'<td class="span3">'.user::pobierzJedno('roles',$val->pobierzRolaID(), 'nazwa').'</td>';
             echo'</tr>';
             }
             ?>
            </table>
          </div>
        </div>
        
        <script src="js/jquery-1.8.2.min.js"></script>
	<script src="js/bootstrap.js"></script>
        
    </body>
</html>
